// Source : https://leetcode.com/problems/ugly-number/
// Author : simba
// Date   : 2016-06-15

package main

import (
	"fmt"
)

func isUgly(num int) bool {
	if num <= 0 {
		return false
	}

	arr := []int{2, 3, 5}

	for i := 0; i < len(arr); i++ {
		for num%arr[i] == 0 {
			num /= arr[i]
		}
	}

	return num == 1
}

func main() {
	//固定测试用例
	s1 := 1
	a1 := isUgly(s1)
	fmt.Println("数", s1)
	fmt.Println("输出答案", a1)
	fmt.Println("正确答案 true")

	s2 := 8
	a2 := isUgly(s2)
	fmt.Println("数", s2)
	fmt.Println("输出答案", a2)
	fmt.Println("正确答案 true")

	s3 := 14
	a3 := isUgly(s3)
	fmt.Println("数", s3)
	fmt.Println("输出答案", a3)
	fmt.Println("正确答案 false")
}
